-
Notifications
You must be signed in to change notification settings - Fork 753
ADK Middleware Integration #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add core ADKAgent class for bridging Google ADK with AG-UI Protocol - Implement event translation between ADK and AG-UI protocols - Add agent registry for managing multiple ADK agents - Include session lifecycle management with configurable timeouts - Create FastAPI integration with SSE streaming support - Add comprehensive test suite with all tests passing - Include example FastAPI server implementation - Support both in-memory and custom service implementations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add app_name as required first parameter to ADKAgent constructor - Implement comprehensive logging system with component-specific loggers - Add 14 comprehensive automated tests with 100% pass rate - Refactor to SessionLifecycleManager singleton for centralized session management - Implement thread-safe event translation with per-session EventTranslator instances - Add proper error handling in HTTP endpoints with specific error types - Implement proper streaming based on ADK finish_reason detection - Add session encapsulation and automatic cleanup with configurable timeouts - Replace deprecated TextMessageChunkEvent with TextMessageContentEvent - Fix critical concurrency issues and session management bugs - Add complete development environment setup with virtual environment support - Update dependency management to use proper package installation - Rename agent_id to app_name throughout session management for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Update shebangs from #\!/usr/bin/env python3 to #\!/usr/bin/env python in all scripts and tests - Change python3 -m venv commands to python -m venv in documentation and setup scripts - Standardize on 'python' command throughout the project for better compatibility Files updated: - All test files (24 files): Updated shebangs - Shell scripts: quickstart.sh, setup_dev.sh - Documentation: README.md - Examples and utilities: All Python files updated 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove requirement for app_name or app_name_extractor to be specified - Add default behavior that uses agent name from registry as app_name - Update _default_app_extractor to fetch agent name dynamically - Update _get_or_create_runner to accept app_name parameter for dynamic resolution - Add comprehensive test coverage for default app_name behavior - Update examples to demonstrate simplified agent creation without explicit app_name - All 15 tests continue to pass - Update CHANGELOG.md with new functionality BREAKING CHANGES: - ADKAgent no longer requires app_name or app_name_extractor (now optional) - Default behavior automatically uses agent name as app_name 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Move all test_*.py files to tests/ subdirectory - Move run_tests.py to tests/ directory - Update run_tests.py to work from tests directory with proper PYTHONPATH - Fix all import statements in tests to work without hardcoded src. prefix - Update test runner to set PYTHONPATH to include src directory - Fix patch() calls to reference modules without src. prefix - All 15 tests continue to pass after reorganization - Update CHANGELOG.md to reflect test organization improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Mark tool/function calling support as coming soon - Remove manual python-sdk installation step (now via PyPI) - Add required app_name parameter to all ADKAgent examples - Remove unimplemented features from event translation table - Remove State Management and Tool Integration from Advanced Features 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add pytest.ini configuration with proper Python path and async support - Move pytest dependencies to main install_requires for easier setup - Convert test_basic.py to proper pytest format with test functions - Add pytest markers and fixtures to test_text_events.py (maintain backwards compatibility) - Fix test_adk_agent.py for current ADKAgent API and add test isolation - Improve session manager reset to handle closed event loops in pytest - Rename test_server.py to server_setup.py to avoid pytest discovery - Remove deprecated run_tests.py custom test runner Results: All 54 tests now pass with standard pytest commands - pytest: ✅ 54 passed, 0 failed - pytest --cov=src: ✅ 67% code coverage - Async tests work with @pytest.mark.asyncio - Maintains backwards compatibility with existing test functions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…E.md - Remove ADK_Middleware/ directory that was not intended for publication - Remove CLAUDE.md file from repository root - These files are already in .gitignore but were committed by mistake 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Mark event translation as partial (⚠️ ) with "full support coming soon" - Mark state synchronization as not implemented (❌) with "coming soon" - Remove "Comprehensive service integration" line (not planned) - Keep tool/function calling as not implemented (❌) with "coming soon" Provides users with accurate expectations of current capabilities vs planned features. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Create requirements-dev.txt for development dependencies (testing, linting) - Move pytest tools from main requirements to dev extras in setup.py - Update README installation instructions to show dev dependency options - Fix README examples to use correct Agent constructor (not LlmAgent) - Fix ADKAgent constructor examples to use current API parameters - Remove outdated session management parameters from examples - Update service configuration examples to match current implementation All README examples now work with the current codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
### New Features - Add automatic session memory option - expired sessions preserved in ADK memory service - Optional memory_service parameter enables zero-config session history preservation - Comprehensive session memory integration with cleanup, user limits, and manual deletion ### Enhancements - Refactored session management to better leverage ADK's native capabilities - Enhanced SessionManager with streamlined architecture ### Testing - Add 7 comprehensive unit tests for session memory functionality - Total test suite now includes 61 tests (up from 54) - All tests passing with improved coverage ### Dependencies - Update dependency versions in setup.py to match requirements.txt - Bump version to 0.2.0 reflecting significant new functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Replace custom component logger system with standard logging.getLogger() - Remove proprietary logging_config.py module and related complexity - Update all modules (adk_agent, endpoint, event_translator) to follow Python best practices - Remove unnecessary logging test file and interactive configure tool - Update documentation with standard Python logging examples - Maintain all existing functionality while simplifying maintenance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…o app Python needs modules to be organized in their own folders (packages) to import them correctly. By putting your files in a adk_middleware folder, Python can now recognize it as a proper package and allow you to import from it using: from adk_middleware import ADKAgent, AgentRegistry, add_adk_fastapi_endpoint
fix adk_middleware python module and added adk-middleware demo in doj…
- Update README.md: Fix SessionManager import path and class name - Update pytest coverage path to match new module structure - Fix session_manager.py: Use correct attribute name (last_update_time) - Add CLAUDE.md to .gitignore for local documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Fix session attribute references from lastUpdateTime to last_update_time - Update tests in test_session_memory.py and test_session_deletion.py - Ensure consistency with session_manager.py implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Fix session attribute references from lastUpdateTime to last_update_time - Update tests in test_session_memory.py and test_session_deletion.py - Ensure consistency with session_manager.py implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove .timestamp() calls on session.last_update_time (already a float) - Update tests to use float timestamps instead of datetime objects - Resolves runtime errors: 'float' object has no attribute 'timestamp' 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This major release implements full tool support enabling AG-UI Protocol tools to execute within Google ADK agents through an advanced asynchronous architecture. ### New Features: - Complete tool execution system with ExecutionState, ClientProxyTool, and ClientProxyToolset - Background execution support via asyncio tasks with proper timeout management - Comprehensive timeout configuration (execution and tool-level) - Concurrent execution limits with automatic cleanup - 138+ comprehensive tests with 100% pass rate (77% code coverage) - Production-ready error handling and resource management ### New Files: - src/adk_middleware/execution_state.py - Manages background ADK execution state - src/adk_middleware/client_proxy_tool.py - Bridges AG-UI tools to ADK tools - src/adk_middleware/client_proxy_toolset.py - Dynamic toolset creation - examples/comprehensive_tool_demo.py - Complete working example - tests/test_*.py - Comprehensive test coverage for all tool features ### Enhanced: - ADK agents now run in background asyncio tasks while client handles tools - Queue-based communication prevents deadlocks - Tool call IDs properly use ADK function call IDs for consistency - Enhanced logging throughout tool execution flow ### Updated Documentation: - README.md with practical tool examples (human-in-the-loop, document generation) - CHANGELOG.md documenting v0.3.0 release - Realistic business scenarios based on dojo patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Feature/tool support
added tool based generative ui demo for ADK in dojo application fixed agent_id in ADKAgent wrapper now we can have multiple adk agents using add_adk_fastapi_endpoint disable the waiting for the tool response in ClientProxyTool if is_long_running is True (for long running task response will be given by the user this is how HITL works in ADK)
Move adk examples to use uv
Updated instructions to focus on uv usage.
Any update on this PR. When will it get merged and we will receive the support for ADK integration? |
@shubam-koul-revellabs the goal is to get it merged today and released hopefully soon after. |
Merging it as it is, there's going to be a small second PR shortly (just doing a second PR for ease of logistics) to update packaging/publishing etc, but in it goes! |
Wow, awesome contribution @contextablemark! 🚀 |
@contextablemark I truly appreciate your previous contribution, which allowed me to learn from it and complete this implementation. On behalf of my company, I have open-sourced adk-agui-middleware. I would like to ask if it could be listed in your README as part of third-party support. I will continue to actively develop and maintain it. The functionality is already stable, although some usage tips have not yet been fully documented. I will be adding those later, and the project already includes support for History. If you have any suggestions for improvements, I would be glad to hear them and make enhancements. Thank you for your consideration. |
Hi @DennySORA, I'm looking over your repo. Can you please explain what is different between @contextablemark's middleware and yours? By the way, love the diagrams, very nicely laid out as well. |
* feat: initial implementation of ADK middleware for AG-UI Protocol - Add core ADKAgent class for bridging Google ADK with AG-UI Protocol - Implement event translation between ADK and AG-UI protocols - Add agent registry for managing multiple ADK agents - Include session lifecycle management with configurable timeouts - Create FastAPI integration with SSE streaming support - Add comprehensive test suite with all tests passing - Include example FastAPI server implementation - Support both in-memory and custom service implementations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: major refactoring and enhancements to ADK middleware - Add app_name as required first parameter to ADKAgent constructor - Implement comprehensive logging system with component-specific loggers - Add 14 comprehensive automated tests with 100% pass rate - Refactor to SessionLifecycleManager singleton for centralized session management - Implement thread-safe event translation with per-session EventTranslator instances - Add proper error handling in HTTP endpoints with specific error types - Implement proper streaming based on ADK finish_reason detection - Add session encapsulation and automatic cleanup with configurable timeouts - Replace deprecated TextMessageChunkEvent with TextMessageContentEvent - Fix critical concurrency issues and session management bugs - Add complete development environment setup with virtual environment support - Update dependency management to use proper package installation - Rename agent_id to app_name throughout session management for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * chore: update all python3 references to python for consistency - Update shebangs from #\!/usr/bin/env python3 to #\!/usr/bin/env python in all scripts and tests - Change python3 -m venv commands to python -m venv in documentation and setup scripts - Standardize on 'python' command throughout the project for better compatibility Files updated: - All test files (24 files): Updated shebangs - Shell scripts: quickstart.sh, setup_dev.sh - Documentation: README.md - Examples and utilities: All Python files updated 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: add default app_name behavior using agent name from registry - Remove requirement for app_name or app_name_extractor to be specified - Add default behavior that uses agent name from registry as app_name - Update _default_app_extractor to fetch agent name dynamically - Update _get_or_create_runner to accept app_name parameter for dynamic resolution - Add comprehensive test coverage for default app_name behavior - Update examples to demonstrate simplified agent creation without explicit app_name - All 15 tests continue to pass - Update CHANGELOG.md with new functionality BREAKING CHANGES: - ADKAgent no longer requires app_name or app_name_extractor (now optional) - Default behavior automatically uses agent name as app_name 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * refactor: move all tests to tests/ directory for better organization - Move all test_*.py files to tests/ subdirectory - Move run_tests.py to tests/ directory - Update run_tests.py to work from tests directory with proper PYTHONPATH - Fix all import statements in tests to work without hardcoded src. prefix - Update test runner to set PYTHONPATH to include src directory - Fix patch() calls to reference modules without src. prefix - All 15 tests continue to pass after reorganization - Update CHANGELOG.md to reflect test organization improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: update changelog for test reorganization * Updating requirements.txt. * Added version for asyncio. * docs: update README to reflect current implementation status - Mark tool/function calling support as coming soon - Remove manual python-sdk installation step (now via PyPI) - Add required app_name parameter to all ADKAgent examples - Remove unimplemented features from event translation table - Remove State Management and Tool Integration from Advanced Features 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: implement full pytest compatibility for test suite - Add pytest.ini configuration with proper Python path and async support - Move pytest dependencies to main install_requires for easier setup - Convert test_basic.py to proper pytest format with test functions - Add pytest markers and fixtures to test_text_events.py (maintain backwards compatibility) - Fix test_adk_agent.py for current ADKAgent API and add test isolation - Improve session manager reset to handle closed event loops in pytest - Rename test_server.py to server_setup.py to avoid pytest discovery - Remove deprecated run_tests.py custom test runner Results: All 54 tests now pass with standard pytest commands - pytest: ✅ 54 passed, 0 failed - pytest --cov=src: ✅ 67% code coverage - Async tests work with @pytest.mark.asyncio - Maintains backwards compatibility with existing test functions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: remove accidentally committed ADK_Middleware directory and CLAUDE.md - Remove ADK_Middleware/ directory that was not intended for publication - Remove CLAUDE.md file from repository root - These files are already in .gitignore but were committed by mistake 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * docs: update README feature status to reflect current implementation - Mark event translation as partial (⚠️ ) with "full support coming soon" - Mark state synchronization as not implemented (❌) with "coming soon" - Remove "Comprehensive service integration" line (not planned) - Keep tool/function calling as not implemented (❌) with "coming soon" Provides users with accurate expectations of current capabilities vs planned features. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * refactor: separate dev dependencies and fix README examples - Create requirements-dev.txt for development dependencies (testing, linting) - Move pytest tools from main requirements to dev extras in setup.py - Update README installation instructions to show dev dependency options - Fix README examples to use correct Agent constructor (not LlmAgent) - Fix ADKAgent constructor examples to use current API parameters - Remove outdated session management parameters from examples - Update service configuration examples to match current implementation All README examples now work with the current codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: add automatic session memory and refactor session management ### New Features - Add automatic session memory option - expired sessions preserved in ADK memory service - Optional memory_service parameter enables zero-config session history preservation - Comprehensive session memory integration with cleanup, user limits, and manual deletion ### Enhancements - Refactored session management to better leverage ADK's native capabilities - Enhanced SessionManager with streamlined architecture ### Testing - Add 7 comprehensive unit tests for session memory functionality - Total test suite now includes 61 tests (up from 54) - All tests passing with improved coverage ### Dependencies - Update dependency versions in setup.py to match requirements.txt - Bump version to 0.2.0 reflecting significant new functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * refactor: simplify logging system to use standard Python logging - Replace custom component logger system with standard logging.getLogger() - Remove proprietary logging_config.py module and related complexity - Update all modules (adk_agent, endpoint, event_translator) to follow Python best practices - Remove unnecessary logging test file and interactive configure tool - Update documentation with standard Python logging examples - Maintain all existing functionality while simplifying maintenance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix adk_middleware python module and added adk-middleware demo in dojo app Python needs modules to be organized in their own folders (packages) to import them correctly. By putting your files in a adk_middleware folder, Python can now recognize it as a proper package and allow you to import from it using: from adk_middleware import ADKAgent, AgentRegistry, add_adk_fastapi_endpoint * import change * venv in git ignore * fixing test adk_middleware imports * all test cases fixed * Update documentation and fix session attribute name - Update README.md: Fix SessionManager import path and class name - Update pytest coverage path to match new module structure - Fix session_manager.py: Use correct attribute name (last_update_time) - Add CLAUDE.md to .gitignore for local documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix test failures: Update attribute name references - Fix session attribute references from lastUpdateTime to last_update_time - Update tests in test_session_memory.py and test_session_deletion.py - Ensure consistency with session_manager.py implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix test failures: Update attribute name references - Fix session attribute references from lastUpdateTime to last_update_time - Update tests in test_session_memory.py and test_session_deletion.py - Ensure consistency with session_manager.py implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix session manager last_update_time timestamp bug - Remove .timestamp() calls on session.last_update_time (already a float) - Update tests to use float timestamps instead of datetime objects - Resolves runtime errors: 'float' object has no attribute 'timestamp' 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Add complete bidirectional tool support for ADK middleware This major release implements full tool support enabling AG-UI Protocol tools to execute within Google ADK agents through an advanced asynchronous architecture. ### New Features: - Complete tool execution system with ExecutionState, ClientProxyTool, and ClientProxyToolset - Background execution support via asyncio tasks with proper timeout management - Comprehensive timeout configuration (execution and tool-level) - Concurrent execution limits with automatic cleanup - 138+ comprehensive tests with 100% pass rate (77% code coverage) - Production-ready error handling and resource management ### New Files: - src/adk_middleware/execution_state.py - Manages background ADK execution state - src/adk_middleware/client_proxy_tool.py - Bridges AG-UI tools to ADK tools - src/adk_middleware/client_proxy_toolset.py - Dynamic toolset creation - examples/comprehensive_tool_demo.py - Complete working example - tests/test_*.py - Comprehensive test coverage for all tool features ### Enhanced: - ADK agents now run in background asyncio tasks while client handles tools - Queue-based communication prevents deadlocks - Tool call IDs properly use ADK function call IDs for consistency - Enhanced logging throughout tool execution flow ### Updated Documentation: - README.md with practical tool examples (human-in-the-loop, document generation) - CHANGELOG.md documenting v0.3.0 release - Realistic business scenarios based on dojo patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * added tool based generative ui demo added tool based generative ui demo for ADK in dojo application fixed agent_id in ADKAgent wrapper now we can have multiple adk agents using add_adk_fastapi_endpoint disable the waiting for the tool response in ClientProxyTool if is_long_running is True (for long running task response will be given by the user this is how HITL works in ADK) * print remove * fix tool wrapper test case * fix test_endpoint trying to patch 'adk_middleware.EventEncoder', but the EventEncoder is actually imported from 'ag_ui.encoder' as we can see in the endpoint.py file * test cases fixed also added 6 new test cases for long running tools - **NEW**: `test_client_proxy_tool_long_running_no_timeout()` - verifies long-running tools ignore timeout settings - **NEW**: `test_client_proxy_tool_long_running_vs_regular_timeout_behavior()` - compares timeout behavior between regular and long-running tools - **NEW**: `test_client_proxy_tool_long_running_cleanup_on_error()` - ensures proper cleanup on event emission errors - **NEW**: `test_client_proxy_tool_long_running_multiple_concurrent()` - tests multiple concurrent long-running tools - **NEW**: `test_client_proxy_tool_long_running_event_emission_sequence()` - validates correct event emission order - **NEW**: `test_client_proxy_tool_is_long_running_property()` - tests property access and default values * Update typescript-sdk/integrations/adk-middleware/src/adk_middleware/client_proxy_tool.py * Release 0.3.2: Hybrid tool execution model with per-tool configuration - Add hybrid execution model bridging AG-UI stateless runs with ADK stateful execution - Add per-tool execution mode configuration via tool_long_running_config parameter - Add mixed execution mode support for combining long-running and blocking tools - Add execution resumption functionality using ToolMessage for paused executions - Add 13 comprehensive execution resumption tests - Add 13 integration tests for complete hybrid flow - Add comprehensive documentation for hybrid tool execution model - Expand test suite to 185 tests with comprehensive coverage - Enhance ClientProxyToolset with per-tool is_long_running configuration - Improve timeout behavior and resource management for mixed execution modes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Comprehensive unit test coverage improvements for low-coverage modules This commit adds comprehensive test suites to achieve 100% coverage on previously untested modules: • **utils/__init__.py** - 100% coverage (5 tests) - Tests module imports, __all__ attribute, docstring, and re-export functionality • **utils/converters.py** - 100% coverage (43 tests) - Tests AG-UI ↔ ADK message conversion functions with edge cases - Tests state ↔ JSON patch conversion utilities - Tests text extraction and error handling utilities - Fixed converter to create proper FunctionCall Pydantic models • **agent_registry.py** - 100% coverage (38 tests) - Tests singleton behavior, agent registration, and factory patterns - Tests agent resolution order and error handling - Tests comprehensive logging and state management • **endpoint.py** - 100% coverage (22 tests) - Tests FastAPI endpoint creation and configuration - Tests SSE event streaming and error handling - Tests input validation and HTTP method restrictions - Tests integration flows and encoding scenarios • **event_translator.py** - 95% coverage (33 tests) - Tests comprehensive event translation paths - Tests streaming state management and message boundaries - Tests function call handling and state delta conversion - Tests exception handling and force-close scenarios Key improvements: - Fixed converter to use proper Pydantic models instead of dictionaries - Added comprehensive error handling and edge case testing - Achieved 141 new tests with 100% pass rate - Improved test isolation and async testing patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Update changelog for improved test coverage Added changelog entry for comprehensive test coverage improvements: - Overall test coverage increased to 94% - 141 new comprehensive unit tests added - 7 out of 11 modules now have 100% coverage - All modules achieve ≥86% coverage - No new functionality added, only test improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * tool submission changes for ADK middleware When a tool is called, the response doesn't come back in the same request/response cycle in ADK HITL Workflow Instead, the tool response is sent as a separate, subsequent request using the same session ID This means the code doesn't need to handle tool result submissions in the middle of an ongoing execution * refactor: align tool behavior with ADK standards and fix test coverage MAJOR CHANGES: * Refactored tool behavior to align with ADK standards - long-running tools now return tool call IDs instead of None * Updated hybrid tool execution model to properly handle tool call ID management and validation * Long-running tools now return `adk-{uuid}` tool call IDs immediately for fire-and-forget execution pattern CRITICAL FIXES: * Fixed tool call ID mismatch detection to properly warn when tool results are submitted for non-existent tool calls * Fixed all failing hybrid flow integration tests to expect tool call IDs from long-running tools * Updated 326 tests to align with new ADK-compliant tool behavior (all tests now pass) * Enhanced tool result submission logic to properly categorize blocking vs long-running tool results * Improved warning messages for tool call ID validation failures TECHNICAL ARCHITECTURE: * Tool Return Values: Long-running tools return `adk-{uuid}` tool call IDs instead of None for proper ADK compliance * Tool Validation: Enhanced tool result submission logic with proper categorization of blocking vs long-running results * Warning System: Improved tool call ID mismatch detection when active executions have pending tools but submitted tool call ID is not found * Test Alignment: Updated all hybrid flow integration tests to validate correct tool call ID return patterns TESTING IMPROVEMENTS: * Improved test coverage to 94% overall with comprehensive unit tests for previously untested modules * Tool execution now fully compliant with ADK behavioral expectations * Enhanced logging for tool call ID tracking and validation throughout execution flow TECHNICAL NOTES: * Extensive debug logging messages remain in place throughout the codebase for ongoing development and troubleshooting * Debug messages will be removed in a future cleanup release once development stabilizes 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Complete ADK middleware test suite fixes - achieve 100% test pass rate This comprehensive fix addresses all remaining test failures and brings the test suite to a perfect 326/326 passing tests (100% pass rate). ## Key Fixes Applied ### Mock Context Issues (Major) - Added proper mock_tool_context fixtures to all affected test files - Fixed pydantic validation errors for tool_call_id expecting string type - Updated test method signatures to include mock_tool_context parameter - Replaced local MagicMock() instances with consistent fixture usage ### Toolset Resource Management - Fixed ClientProxyToolset.close() to properly cancel pending futures - Added resource cleanup for blocking tools when execution completes - Maintained separation between long-running (fire-and-forget) and blocking tools - Updated tests to expect proper future cancellation behavior ### Event Streaming Protocol Updates - Updated tests to account for enhanced _stream_events method behavior - Fixed expectations for RUN_FINISHED events automatically emitted on completion - Updated mock function signatures to match _stream_events(execution, run_id) parameters - Aligned test expectations with RunStartedEvent emission for tool result submissions ### Error Handling Corrections - Fixed malformed tool message test to expect graceful empty content handling - Corrected test expectations to match actual error handling behavior - Ensured proper validation of tool result processing edge cases ## Test Coverage Improvements - Fixed 13 mock context validation errors across multiple test files - Resolved 4 toolset resource cleanup test failures - Updated 6 event streaming expectation mismatches - Corrected 2 tool result flow integration test assertions - Fixed 2 execution resumption lifecycle test expectations - Aligned 1 error handling test with actual graceful behavior ## Impact - **Before**: 19 failures out of 326 tests (94.2% pass rate) - **After**: 0 failures out of 326 tests (100% pass rate) - All critical ADK middleware functionality now fully tested and validated - Enhanced test reliability and maintainability for future development 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: simplify to all-long-running tool architecture with critical bug fixes BREAKING CHANGES: - Simplified to all-long-running tool execution model, removing hybrid complexity - Removed blocking tool execution mode - all tools now use long-running behavior - Removed tool futures, execution resumption, and hybrid execution state management - Eliminated per-tool execution mode configuration CRITICAL BUG FIX: - Fixed tool result accumulation causing Gemini API errors about function response count mismatch - Modified _extract_tool_results() to only extract most recent tool message instead of all from conversation history - Prevents multiple tool responses being passed to Gemini when only one function call expected ARCHITECTURE IMPROVEMENTS: - ClientProxyTool now always returns None immediately after emitting events, wrapping LongRunningFunctionTool - Removed runner caching entirely to avoid stale event queue references - Agent tool combination now uses model_copy() to avoid mutating original agent instances - All tool result submissions start new executions as standalone requests HITL SUPPORT: - Enhanced session-based pending tool call tracking using ADK session state - Sessions with pending tool calls preserved during cleanup (no timeout for HITL workflows) - Automatic tool call tracking when tools emit events and response tracking when results received - Standalone tool result handling for results without active executions TESTING: - Comprehensive test suite refactored for all-long-running architecture (272 tests passing) - Removed obsolete test files for hybrid functionality (execution_resumption, hybrid_flow_integration, tool_timeouts) - Added comprehensive HITL tool call tracking tests - Fixed all test expectations to match new architectural behavior - Enhanced test isolation with proper SessionManager reset PERFORMANCE & RELIABILITY: - Eliminated complex execution state tracking and tool future management overhead - Removed potential deadlocks and race conditions from hybrid execution model - All tools now follow same execution pattern, reducing cognitive load and bugs - Improved session cleanup logic with pending tool call awareness 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * prompt change * feat: add GitHub Actions CI workflow for ADK middleware - Create .github/workflows/adk-middleware-ci.yml for automated testing - Configure CI to run pytest on pull requests affecting ADK middleware - Use path filtering to only trigger on relevant file changes - Test on latest Python 3.x version using GitHub-hosted runners - Add pip dependency caching for faster builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: fix memory persistence and tool ID mapping (v0.4.1) - Fix memory persistence across sessions with consistent user ID extraction - Fix ADK tool call ID mapping to prevent protocol mismatch - Simplify SessionManager._delete_session() to eliminate redundant lookups - Add comprehensive memory integration test suite (8 tests) - Update README with memory tools integration and testing guidance - Clean up debug logging statements throughout codebase 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Adding files that were left out of PR ag-ui-protocol#16 and removing unusable workflows. * fix: update test to check debug logging instead of info The endpoint correctly uses debug level for HTTP response logging, but the test was checking for info level calls. Updated test to match the appropriate logging level. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * shared state demo for dojo app Added Shared State demo for Dojo App remove the state_delta event and using state_snapshot event * shared_state_agent added * fix: resolve EventType.STATE_DELTA patch error (issue ag-ui-protocol#20) - Change from "replace" to "add" operations in state delta events - JSON Patch "add" works for both new and existing paths - Fixes "OPERATION_PATH_UNRESOLVABLE" errors on frontend - Update existing tests to expect "add" operations - Add comprehensive test coverage for edge cases: * Nested objects and arrays * Mixed value types (string, number, boolean, null) * Special characters in keys 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: add SystemMessage support and fix tool result race condition - SystemMessage as first message now appended to ADK agent instructions (issue ag-ui-protocol#22) - Fixed race condition where tool calls were removed before checking pending status - Improved empty tool result handling with graceful JSON parsing fallback - Added comprehensive tests for SystemMessage functionality - Consolidated agent copying logic to avoid unnecessary duplicates - Added debug logging for tool result processing - Removed unused toolset parameter from _run_adk_in_background 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * dojo app backend command added * session update comments added * _create_state_delta_event added back * added memory back again * simple instructions * twice generative AI and HITL fixed * unit test updated for _translate_function_calls extra params removed from _translate_function_calls in unit test cases * Update typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py Co-authored-by: contextablemark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/tests/test_event_translator_comprehensive.py Co-authored-by: contextablemark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/examples/fastapi_server.py Co-authored-by: contextablemark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py Co-authored-by: contextablemark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py Co-authored-by: contextablemark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/src/adk_middleware/event_translator.py Co-authored-by: contextablemark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py Co-authored-by: contextablemark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/examples/fastapi_server.py Co-authored-by: contextablemark <[email protected]> * test cases for session management added * Update typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py * Update typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py * Update typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py * adk_shared_state_agent fixed * fix: resolve flaky test_bulk_update_user_state_mixed_results The test was relying on undefined set iteration order, causing it to fail when run with other tests but pass when run individually. Fixed by making the assertions order-agnostic while maintaining the test's intent. - Changed from expecting specific key-value pairs to verifying the overall behavior - Test now checks that one update succeeds and one fails, regardless of order - Ensures consistent test results across different Python hash randomization seeds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * snapshot error fixed snapshot error fixed and frontend tool will be override by backend tool if same toolname is there * function response this is essential for scenerios when user has to render function response at frontend * Update agent.py added the before_model_modifier callback which is modifying the system instruction to include the current recipe state also cleaned the agent code * refactor: use SessionManager methods for pending tool call state management - Replace direct session state manipulation with SessionManager's get_state_value and set_state_value methods - Remove direct usage of EventActions and append_event in favor of SessionManager abstraction - Maintain same behavior while improving code organization and consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * removing the print statements * long running tool backend handling These changes will allow the ADK agents to define the long running tool on the backend side as well defining tools at the backend side is still crucial because copilot kit does not allow to assign any tool to a sub agent in a multi agent system so this is why we need to define the tool at the backend * update the instruction for the chat demo * predictive state demo added predictive state demo added * Update typescript-sdk/integrations/adk-middleware/examples/fastapi_server.py Co-authored-by: Mark <[email protected]> * fix: use SessionManager methods for pending tool call state management - Replace direct session service access with SessionManager's get_state_value and set_state_value methods - Simplifies state management by using higher-level abstraction - Fixes issue ag-ui-protocol#25 by using proper SessionManager API for state updates - Maintains same functionality with cleaner implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * backend tool pending issue fixed * Update Changelog.md * TestEventTranslatorComprehensive tests fixed * recipe prompt change added title state change the recipe prompt * model updated for human in loop * Initial documentation changes * feat: eliminate AgentRegistry and implement direct agent embedding - BREAKING: ADKAgent constructor now requires adk_agent parameter instead of agent_id - BREAKING: Removed AgentRegistry dependency - agents directly embedded in middleware instances - BREAKING: Removed agent_id parameter from ADKAgent.run() method - BREAKING: AgentRegistry class removed from public API - ARCHITECTURE: Eliminated confusing indirection where endpoint agent didn't determine execution - ARCHITECTURE: Each ADKAgent instance now directly holds its ADK agent instance - ARCHITECTURE: Simplified method signatures and removed agent lookup overhead - FIXED: All 271 tests now pass with new simplified architecture - EXAMPLES: Updated examples to demonstrate direct agent embedding pattern - TESTS: Updated all test fixtures to work with new agent embedding pattern 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * docs: update documentation to remove AgentRegistry references - Update README.md to use direct agent embedding pattern - Remove all references to AgentRegistry and agent_id - Update code examples to show ADKAgent with adk_agent parameter - Update LOGGING.md to remove agent_registry component - Show multi-agent setup using separate ADKAgent instances 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * stopping condition added * feat: make session_service configurable in ADKAgent constructor - Add optional session_service parameter to ADKAgent constructor - Remove TODO comment about making session service configurable - Update docstring to document the new parameter - Session service now defaults to InMemorySessionService if not provided - Addresses PR review feedback from @syedfakher27 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * print statement removed * Removing registry entries and redundant constructor. * Added support for agentFilesMapper. * Fix ADKAgent test suite for new architecture Updated all test fixtures and endpoint implementation to match the new ADKAgent.run(input_data) signature after removing agent_id parameter. All 271 tests now pass with the simplified architecture from issue-24-cleanup-agent-registration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Added in updated file content. * Add e2e tests for ADK middleware agentic chat - Create Playwright test for ADK middleware integration - Test initial greeting message display - Test agent response to user question ("Four") - Properly wait for second assistant message with timeout - Verify complete conversation flow (3 messages total) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: Make ADK middleware base URL configurable via environment variable - Add ADK_MIDDLEWARE_URL environment variable support in dojo app - Configure adkMiddlewareUrl in env.ts with default to http://localhost:8000 - Update all ADK middleware agent URLs to use the configurable base URL - Update CHANGELOG to document configuration changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: Upgrade Google ADK dependency to 1.9.0 - Updated google-adk from 1.6.1 to 1.9.0 in requirements.txt - All 271 tests pass successfully with the new version - No code changes required for compatibility - Updated CHANGELOG.md with dependency upgrade information 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * docs: Extensive documentation restructuring for improved organization - Created separate documentation files for better organization: - CONFIGURATION.md: All configuration options - TOOLS.md: Tool support documentation - USAGE.md: Usage examples and patterns - ARCHITECTURE.md: Technical architecture details - Updated README.md to focus on quick start and overview - Removed outdated comprehensive_tool_demo.py example - Updated dependency requirements and test counts - Bumped version to 0.6.0 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: support instructions provider for agents * fix: support of before_agent_callback in case of a direct content response * Added aiohttp dependency. * - General cleanup * Update typescript-sdk/integrations/adk-middleware/src/adk_middleware/event_translator.py Fix parenthetical usage in the message. Co-authored-by: Mark <[email protected]> * Update typescript-sdk/integrations/adk-middleware/tests/test_text_events.py Fix unnecessary indentation. Co-authored-by: Mark <[email protected]> * fix: support of before_agent_callback in case of a direct content response - fix PR comments * fix: support instructions provider for agents - handle sync cases and empty instructions * fix: update tests to match new logging levels from PR ag-ui-protocol#49 Tests were failing after PR ag-ui-protocol#49 changed ADK Event logging from info to debug level. Updated test_event_translator_comprehensive.py to expect the correct log levels: - test_translate_function_calls_detection now checks for debug message in all debug calls - test_event_logging_coverage now looks for "ADK Event:" in debug logs instead of info logs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: change misleading 'Session not found' warnings to debug messages The warnings were appearing during normal operation when sessions were being created or when state updates were attempted before session initialization. These are not actual error conditions but expected behaviors in the async flow. Changed logging level from warning to debug with more descriptive messages to reduce log noise and confusion. Co-Authored-By: Claude <[email protected]> * fix: make error handling test more robust Replace brittle string matching in test_error_handling with more reliable assertions that check for error code and message presence instead of specific error message content. This prevents test failures when underlying error messages change. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: upgrade Google ADK requirement to >=1.14.0 - Update google-adk requirement from >=1.9.0 to >=1.14.0 in both setup.py and requirements.txt - All 277 tests pass with ADK 1.14.1, confirming compatibility - No breaking changes or code modifications required 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * feat: optimize session state management with dictionary-based lookups Replace inefficient O(n*m) linear searches with O(1) dictionary lookups for session metadata retrieval. This significantly improves performance when handling large numbers of concurrent sessions. Key optimizations: - Add session lookup cache for O(1) session metadata access - Optimize _remove_pending_tool_call() and _has_pending_tool_calls() - Maintain backward compatibility with fallback to linear search - Add proper cache cleanup in close() method Addresses issue ag-ui-protocol#70: Session state management efficiency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * refactor: remove redundant execution checks in _start_new_execution Simplify the execution handling logic by removing duplicate checks for existing executions. The original code performed two nearly identical checks for the same condition, which was redundant. Changes: - Consolidate execution existence check into single block - Remove unnecessary duplicate condition checking - Maintain same functional behavior while improving code clarity - Reduce code complexity and improve maintainability Addresses issue ag-ui-protocol#72: Remove redundant code checks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * move examples folder out before refactor * New examples folder * Add creds check * delete moved code * move remaining examples2 to examples/other * make haiku generator more flexible * fixup docs route * codegen * Restructure adk examples to use uv * Fix HITL examples via prompt * Migrate e2e tests from old e2e2 package * fix agentic chat tests with prompting * fix irrelevant testcase * wrap all e2e in descriptors * update genned docs * fix absolute path * disable predictive state for now * Update README.md Updated instructions to focus on uv usage. --------- Co-authored-by: Mark Fogle <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Syed Fakher <[email protected]> Co-authored-by: evgeny-l <[email protected]> Co-authored-by: Evgeny Leksunin <[email protected]> Co-authored-by: Max Korp <[email protected]>
Thank you for your inquiry. For this new ADK, I implemented the following:
![]() Our company’s upcoming AI-related features will all be built around ADK as the core, with AGUI fully adopted on the frontend. This requires product-grade processing and full support for multi-pod deployments, as our scale is significant. To address this, we completed the entire middleware layer, and after discussion, decided to open source it. We also plan to maintain it long-term. Thank you for your question, and we hope this will help more people in the future. |
@DennySORA, this ADK Middleware integration has been merged, but if you see something lacking or you can make an improvement, we're happy to review any PR you'd like to make. |
Thank you. I understand that the current ADK Middleware has already been merged and is now the first-party implementation recommended by AGUI. At this point, the gap between my implementation and the merged architecture is quite significant. They can essentially be regarded as two entirely different programs. In addition, since my release is published under the name of my company, it may not be possible to merge it directly into your project due to legal restrictions. My hope is that you could reference my ADK Middleware as an optional choice in your README. Thank you. |
@DennySORA, sure thing. We'd like to work with you to fill any gaps you see, as the community is the one that benefits here. |
Addresses #54